__author__='fengfan'
import logging
import logging.config
import time
import os
import logging.handlers
#if __name__=='__main__':

logging.config.fileConfig('../conf/env/mylog.conf')  # 该路径是调用env下面的mylog日志配置文件
print('conf/env/mylog.conf')
logger = logging.getLogger(__name__)
curTime = time.strftime('%Y%m%d%H%M%S', time.localtime())
logFile = r'C:\Users\feng\Desktop\python01\fengfan_src\log\\' + curTime + '.log'

fmt = '[%(asctime)s](%(levelname)s)%(name)s : %(message)s\n'
formartter = logging.Formatter(fmt)

handler = logging.handlers.RotatingFileHandler(logFile, maxBytes=4096000000, backupCount=9)
consoleLog=logging.StreamHandler()  #控制台

handler.setFormatter(formartter)
consoleLog.setFormatter(formartter)   #控制台

logger.setLevel(logging.INFO)
consoleLog.setLevel(logging.INFO)   #控制台

logger.addHandler(handler)
logger.addHandler(consoleLog)  #控制台







